﻿using B.S.Passport.Domain;
using B.S.Passport.ErrorCode;
using B.S.Passport.Read.API.Application.Command123;
using B.S.Passport.Read.API.Application.Command123.ProductNameCommand;
using B.S.Passport.Read.API.Application.Command123.PurNameCommand;
using B.S.Passport.Read.API.Dto;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Passport.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class WhouaseController : ControllerBase
    {
        public readonly IMediator mediator;

        public WhouaseController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取仓库类型
        /// </summary>
        /// <param name="addWhouse"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<WHouseModel>>> GetWhouse([FromQuery]GetWHouseModelCommand addWhouse)
        {
            return mediator.Send(addWhouse);
        }
        /// <summary>
        /// 获取库位类型
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        public Task<ApiResult<List<WHouseType>>> GetWHouseType([FromQuery] GetWHouseTypeCommand addWhouse)
        {
            return mediator.Send(addWhouse);
        }
        /// <summary>
        /// 获取库位列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public Task<ApiResult<Apipage<WhouaseDto>>> GetWarehouse([FromQuery] GetWarehouseCommand getWhouse)
        {
            return mediator.Send(getWhouse);
        }
        /// <summary>
        /// 获取产品信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public Task<ApiResult<Apipage<ProductModel>>> GetProductModels([FromQuery] GetProductNameCommand getWhouse)
        {
            return mediator.Send(getWhouse);
        }
        /// <summary>
        /// 获取采购信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public Task<ApiResult<Apipage<pDto>>> GetPurchases([FromQuery] GetPurchaseCommand getWhouse)
        {
            return mediator.Send(getWhouse);
        }
    }
}
